package org.easybuy.lintenter;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.easybuy.dao.NewsDao;
import org.easybuy.daoimpol.NewsDaoImopl;
import org.easybuy.entity.News;

public class NewsServletContextLintener implements ServletContextListener {

	@Override
	public void contextDestroyed(ServletContextEvent arg0) {
		// 暂无需求

	}

	@Override
	public void contextInitialized(ServletContextEvent arg0) {
		NewsDao newsDao = new NewsDaoImopl();
		ServletContext appliction = arg0.getServletContext();
		List<News> list = new ArrayList<News>();
		list = newsDao.getIndexNews();
		appliction.setAttribute("SHOW_INDEX_NEWS", list);
	}

}
